<template>
  <div id="app">
    <Header :key="updateKey" @updateKeyFn="updateKeyFn" />
    <router-view @updateKeyFn="updateKeyFn" />
    <Footer @updateKeyFn="updateKeyFn" />
    <Login @updateKeyFn="updateKeyFn" />
    <transition name="fade">
      <Toast v-show="$store.state.toast.show" />
    </transition>
  </div>
</template>

<script>
import Header from "@/components/Header.vue";
import Footer from "./components/Footer.vue";
import Login from "@/components/Login.vue";
import Toast from "@/components/Toast.vue";
export default {
  data() {
    return {
      updateKey: 0,
    };
  },
  methods: {
    // 更新header
    updateKeyFn() {
      this.updateKey++;
    },
  },
  components: {
    Header,
    Footer,
    Login,
    Toast,
  },
};
</script>

<style lang="less">
#app {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  list-style: none;
  background: #f5f5f5;
}
.fade-enter-active, 
.fade-leave-active {
  transition: opacity 0.5s linear;
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
  opacity: 0;
}
.fade-enter-to, 
.fade-leave {
  opacity: 1;
}
</style>
